﻿''' <summary>
''' This is the result of a script execution.
''' </summary>
''' <remarks></remarks>
''' <editHistory></editHistory>
Public Class ScriptExecutionResult

    'TODO: Add a property that indicates success / faulure (do we need a warning or information state?)

    Private _scriptItem As ScriptItem
    Private _resultText As String
    Private _successful As Boolean

    ''' <summary>
    ''' Creates a new instance of the ScriptExecutionResult class.
    ''' </summary>
    ''' <param name="scriptItem">The script item that was executed.</param>
    ''' <param name="resultText">The result text to display to the user.</param>
    ''' <remarks></remarks>
    Friend Sub New(ByVal scriptItem As ScriptItem, _
            ByVal resultText As String, _
            ByVal successful As Boolean)

        If scriptItem Is Nothing Then Throw New ArgumentNullException("scriptItem")

        _resultText = resultText
        _scriptItem = scriptItem
        _successful = successful

    End Sub

    ''' <summary>
    ''' Gets the result text for this result
    ''' </summary>
    ''' <value></value>
    ''' <remarks></remarks>
    Public ReadOnly Property ResultText() As String
        Get
            Return _resultText
        End Get
    End Property

    ''' <summary>
    ''' Gets the script item that generated this result
    ''' </summary>
    ''' <value></value>
    ''' <remarks></remarks>
    Public ReadOnly Property ScriptItem() As ScriptItem
        Get
            Return _scriptItem
        End Get
    End Property

    ''' <summary>
    ''' Gets a flag indicating whether the script was succesfully executed or not.
    ''' </summary>
    ''' <value></value>
    ''' <remarks></remarks>
    Public ReadOnly Property Successful() As Boolean
        Get
            Return _successful
        End Get
    End Property

End Class
